<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/includes/common-import.jsp"%>
<%@ taglib uri="/page" prefix="p"%>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
<head>
<meta charset="utf-8" />
<title>${systemName}</title>
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<meta content="" name="description" />
<meta content="" name="author" />
<%@ include file="/WEB-INF/includes/common-component-list.jsp"%>
<script type="text/javascript">
    function changePass(resultId,pass,studentId,state){
    	 $.ajax( { 
             type : "GET", 
             url : "${basePath}studentExamResult/checkPass", 
             data : "resultId="+resultId+"&pass="+pass+"&studentId="+studentId, 
             dataType: "text", 
             success : function(msg) { 
                if(parseInt(msg)==1){
                	$("#passFlag"+state).html("通过");
                }
                else{
                	$("#passFlag"+state).html("未通过");
                }
             } 
         }); 
    }
</script>
</head>
<body class="page-header-fixed">
	<%@ include file="/WEB-INF/includes/header.jsp"%>
	<!-- BEGIN CONTAINER -->
	<div class="page-container row-fluid">
		<%@ include file="/WEB-INF/includes/leftMenu.jsp"%>
		<div class="page-content">
			<!-- BEGIN PAGE CONTAINER-->
			<div class="container-fluid">
				<!-- BEGIN PAGE HEADER-->
				<div class="row-fluid">
					<div class="span12">
						<h3 class="page-title">五证考核结果管理</h3> <span id="cc"></span>
					</div>
				</div>
				<div class="row-fluid">
					<div class="span12">
						<form id="searchForm" class="form-horizontal"
							action="${basePath }studentExamResult" method="post">
							<div class="portlet">
								<div class="portlet-title">
									<div class="input-prepend input-append">
										<span class="add-on"><i class="icon-search"></i>
										班级名称<input
											class="m-wrap placeholder-no-fix" type="text"
											placeholder="" id="className" name="map['className']"
											value="${searchParams.map['className'] }" />
										学生名称<input
											class="m-wrap placeholder-no-fix" type="text"
											placeholder="" id="studentName" name="map['studentName']"
											value="${searchParams.map['studentName'] }" />
											<button type="submit" class="btn green pull-right">查询</button>
										</span> 
										
									</div>
								</div>
							</div>
						</form>
						<div class="alert alert-success ${empty MESSAGE ?'hide':'' }">
							<button class="close" data-dismiss="alert"></button>
							<span>${MESSAGE }</span>
						</div>
						<div class="portlet box light-grey">
							<div class="clearfix">
								<div class="btn-group">
									<a id="sample_editable_1_new" class="btn green"
										href="${basePath }studentExamResult/create"> 新增 
										<i class="icon-plus"></i>
									</a>
								</div>
							</div>
							<table class="table table-striped table-bordered table-hover" id="sample_1">
								<thead>
									<tr>
										<th style="width: 15%;">班级</th>
										<th style="width: 7%;">学生姓名</th>
										<c:forEach items="${certlist}"  var="certlist" varStatus="status">
											<th style="width:10%;">${certlist.certName } </th>
										</c:forEach>
										<th style="width:8%;">通过状态</th>
										<th style="width:5%;">操作</th>
									</tr>
								</thead>
								<tbody>
									<c:forEach items="${studentList}" var="studentList" varStatus="status1">
										<tr class="odd gradeX">
											<td>${studentList.className }</td>
											<td>${studentList.truename }</td>
											<c:forEach items="${studentList.listResult}" var="listResult" varStatus="status2">
														<c:if test="${listResult.resultId==0}" >
																<td>
																    <c:out value="没有选入该证"></c:out>
																 </td>
														</c:if>
														<c:if test="${listResult.resultId!=0}" >
															<td>
																<select id="examScoreResult[${status1.index}][${status2.index}].pass" name="examScoreResult[${status1.index}][${status2.index}].pass"
																 onchange="changePass('${listResult.resultId}',this.value,'${listResult.studentId}','${status1.index}')"
																 style="width: 80px">
																	<c:if test="${listResult.pass==1}">
																           <option value="0">未通过</option>
																          <option value="1" selected="selected">通过</option>
																     </c:if>
																     <c:if test="${listResult.pass==0}">
																             <option value="0" selected="selected">未通过</option>
																          <option value="1" >通过</option>
																     </c:if>
																</select>  
															</td>       
													    </c:if>
											</c:forEach>
											<td>
											  <c:if test="${studentList.passFlag==0 }">
											  	<span id="passFlag${status1.index}">未通过 </span>
											  </c:if>
											  <c:if test="${studentList.passFlag==1 }">
											    <span id="passFlag${status1.index}">通过 </span>
											  </c:if>
											     
											</td>
											<td>
												<a class="edit"
												href="${basePath}studentExamResult/delete/${studentList.studentId}">删除</a>
											</td>
										</tr>
									</c:forEach>
								</tbody>
							</table>
							<p:page url="studentExamResult" cpage="${page.cpage }"
								perItem="${page.perItem }" totalItem="${page.totalItem }" />
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
